package com.mab.apipassenger.controller;

import com.mab.apipassenger.service.TokenService;
import com.msb.internalcommon.dto.ResponseResult;
import com.msb.internalcommon.reponese.TokenResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: jiudianliu
 * @Date: 2023/5/26 - 05 - 26 - 14:31
 * @Description: com.mab.apipassenger.controller
 * @version: 1.0
 */

@RestController
public class TokenController {


    @Autowired
    private TokenService tokenService ;


    @PostMapping("/token-refresh")
    public ResponseResult refreshToken (@RequestBody TokenResponse tokenResponse) {
        String refreshTokenSrc = tokenResponse.getRefreshToken() ;
        System.out.println("原来的 refreshToken:" + refreshTokenSrc) ;
        return tokenService.refreshToken(refreshTokenSrc) ;
    }
}
